﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Reflection;
using System.Configuration;
using IBLL;

namespace BLLFAC
{
    public class DataAccess
    {

        // Look up the DAL implementation we should be using
        private static readonly string path = ConfigurationManager.AppSettings["WebBLL"];
        //private static readonly string orderPath = ConfigurationManager.AppSettings["OrdersDAL"];

        private DataAccess() { }

        public static IBLL.IAdminBLL CreateAdmin()
        {
            string className = path + ".AdminBLL";
            return (IBLL.IAdminBLL)Assembly.Load(path).CreateInstance(className);
        }

        public static IBLL.IAlbumBLL CreateAlbum()
        {
            string className = path + ".AlbumBLL";
            return (IBLL.IAlbumBLL)Assembly.Load(path).CreateInstance(className);
        }

        public static IBLL.ICardBLL CreateCard()
        {
            string className = path + ".CardBLL";
            return (IBLL.ICardBLL)Assembly.Load(path).CreateInstance(className);
        }

        public static IBLL.IChargeBLL CreateCharge()
        {
            string className = path + ".ChargeBLL";
            return (IBLL.IChargeBLL)Assembly.Load(path).CreateInstance(className);
        }

        public static IBLL.ICommentBLL CreateComment()
        {
            string className = path + ".CommentBLL";
            return (IBLL.ICommentBLL)Assembly.Load(path).CreateInstance(className);
        }

        public static IBLL.IFollowBLL CreateFollow()
        {
            string className = path + ".FollowBLL";
            return (IBLL.IFollowBLL)Assembly.Load(path).CreateInstance(className);
        }

        public static IBLL.IManageBLL CreateManage()
        {
            string className = path + ".ManageBLL";
            return (IBLL.IManageBLL)Assembly.Load(path).CreateInstance(className);
        }

        public static IBLL.IPhotoBLL CreatePhoto()
        {
            string className = path + ".PhotoBLL";
            return (IBLL.IPhotoBLL)Assembly.Load(path).CreateInstance(className);
        }

        public static IBLL.IPreferenceBLL CreatePreference()
        {
            string className = path + ".PreferenceBLL";
            return (IBLL.IPreferenceBLL)Assembly.Load(path).CreateInstance(className);
        }

        public static IBLL.ISearchBLL CreateSearch()
        {
            string className = path + ".SearchBLL";
            return (IBLL.ISearchBLL)Assembly.Load(path).CreateInstance(className);
        }

        public static IBLL.IShareBLL CreateShare()
        {
            string className = path + ".ShareBLL";
            return (IBLL.IShareBLL)Assembly.Load(path).CreateInstance(className);
        }

        public static IBLL.IUserBLL CreateUser()
        {
            string className = path + ".UserBLL";
            return (IBLL.IUserBLL)Assembly.Load(path).CreateInstance(className);
        }

        


    }
}
